package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询对应的套餐id
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishId(Long[] dishIds);

    /**
     * 根据菜品的ids查询关联套餐的数目
     * @param ids
     * @return
     */
    Integer selectByDishId(Long[] ids);

    /**
     * 向关联表中插入关联数据
     * @param setmealDishesList
     * @param setmealId
     */
    void insertBatch(List<SetmealDish> setmealDishesList, Long setmealId);

    @Select("select * from sky_take_out.setmeal_dish where setmeal_id=#{setMealId}")
    List<SetmealDish> selectBySetmealId(Long setMealId);

    @Delete("delete from sky_take_out.setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);

    Integer selectStatusCount(Long setMealId);

    Integer selectStatusSetMealCount(Long id);
}
